// 版权归 瞄你个汪 所有。使用本代码应遵守相关法律法规和Apache 2.0开源许可要求。
package top.geeke.database.seed;

import top.geeke.constants.AppConfigPool;
import top.geeke.constants.AppConstPool;
import top.geeke.entity.SysConfig;
import top.geeke.toolkit.supertable.seed.SuperSeedData;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 系统配置表种子数据
 * </p>
 *
 * @author 瞄你个汪
 * @since 2024/5/26 8:13
 */
public class SysConfigSeedData implements SuperSeedData<SysConfig> {
    @Override
    public List<SysConfig> getSeedData() {
        return new ArrayList<SysConfig>(){{
            add(newInstance(1300000000101L, "演示环境", AppConfigPool.Sys_Demo, "false", "default", 100, "演示环境", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000102L, "默认密码", AppConfigPool.Sys_Password, "123456", "default", 101, "默认密码", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000103L, "记录操作日志", AppConfigPool.Sys_Oplog, "true", "default", 102, "是否记录操作日志", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000104L, "开启单设备登录", AppConfigPool.Sys_Single_Login, "true", "default", 103, "是否开启单设备登录", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000105L, "开启登录二次验证", AppConfigPool.Sys_Second_Ver, "true", "default", 104, "是否开启登录二次验证", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000106L, "开启图形验证码", AppConfigPool.Sys_Captcha, "true", "default", 105, "是否开启图形验证码", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000107L, "开启水印", AppConfigPool.Sys_Watermark, "true", "default", 106, "是否开启水印", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000108L, "Token过期时间", AppConfigPool.Sys_Token_Expire, "10080", "default", 107, "Token过期时间（分钟）", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000109L, "刷新Token过期时间", AppConfigPool.Sys_Refresh_Token_Expire, "20160", "default", 108, "刷新Token过期时间（分钟）（一般 refresh_token 的有效时间 > 2 * access_token 的有效时间）", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000110L, "发送异常日志邮件", AppConfigPool.Sys_Error_Mail, "true", "default", 109, "是否发送异常日志邮件", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000111L, "开启域登录验证", AppConfigPool.Sys_Domain_Login, "false", "default", 110, "是否开启域登录验证", AppConstPool.PRIMARY_ID));
            add(newInstance(1300000000112L, "开启登录旋转验证", AppConfigPool.Sys_Rotate_Verify, "false", "default", 111, "开启登录旋转验证", AppConstPool.PRIMARY_ID));
        }};
    }

    public SysConfig newInstance(Long id, String name, String code, String value, String groupName, int orderNo, String remark, Long tenantId) {
        SysConfig config = new SysConfig();

        config.setId(id);
        config.setConfigName(name);
        config.setConfigCode(code);
        config.setConfigValue(value);
        config.setGroupCode(groupName);
        config.setOrderNo(orderNo);
        config.setRemark(remark);
        config.setTenantId(tenantId);

        return config;
    }
}
